<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Novo Cursos</title>
        <script type="text/javascript" src="../js/jquery.js" ></script>
        <script type="text/javascript" src="../js/jquery.validate.js"></script>
        <script type="text/javascript" src="../js/forms.js"></script>
        <script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js" ></script>
        <link rel="stylesheet" href="../css/ui-lightness/jquery-ui-1.8.2.custom.css">
    <link rel="stylesheet" href="../css/forms.css"></head>
    <script>
        $(document).ready(function(){
            $("#form").validate({
                rules: {
                    id_area: {required: true,digits: true
                    }                  
                    ,id_tipocurso: {required: true,digits: true
                    }
                    ,nome_curso: {required: true}
                },
                submitHandler: function(form) {
                    salvar(form);
                }
            });    
        });        
    </script>
    <body>
        
        <form name="form" id="form" method="post" action="insert.jsp" >
            <div id="formulario">
                <fieldset><legend>Dados</legend>
                    <legend>Novo Curso</legend>
                    <p><label class="lbInput">Área<em>*</em></label>
                        <sql:query var="query" dataSource="jdbc/dbo_MicrosoftSQLServer">
                            SELECT  * FROM Areas
                        </sql:query>
                        <select name="id_area" >
                            <option value="">Selecione um valor</option>
                            <c:forEach var="row" items="${query.rows}">
                                <option value="${row.id_area}">${row.desc_area}</option>
                            </c:forEach>
                        </select>
                    </p>                  
                    <p><label class="lbInput">Tipo de Curso<em>*</em></label>
                        <sql:query var="queryTipo" dataSource="jdbc/dbo_MicrosoftSQLServer">
                            SELECT  * FROM TipoCursos
                        </sql:query>
                        <select name="id_tipocurso" >
                            <option value="">Selecione um valor</option>
                            <c:forEach var="tipo" items="${queryTipo.rows}">
                                <option value="${tipo.id_tipocurso}">${tipo.desc_tipocurso}</option>
                            </c:forEach>
                        </select>
                    </p>
                    <p><label class="lbInput">Curso<em>*</em></label>
                        <input type="text" name="nome_curso" size="60" maxlength="60" class="required">
                    </p>                    
                    <p>
                        <input class="submit" type="submit" value="Salvar">
                        <input class="submit" type="button" value="Remover" onclick="remover(document.forms[0])" style="visibility:hidden">
                        <input class="submit" type="button" value="Listar" onclick="listar('fm_lista_Cursos.jsp')">
                    </p>
                    <div id="ajax_dados" style="display:block">
                    </div>
                    <div id="msg" style="display:none"></div>
                </fieldset>
            </div>
        <input type="hidden" id="token" name="token" value="${sessionScope.token}" /> </form>
    </body>
</html>
